package com.ys.controller.web.account;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ys.config.MenuId;
import com.ys.entity.finance.TcwPartnerBankInfo;
import com.ys.service.sys.CommonApiService;
import com.ys.vo.W;

@Controller
@RequestMapping("/web/account/tcwPartnerBankInfo")
public class WebTcwPartnerBankInfoController {
	

	@Autowired
	private CommonApiService<TcwPartnerBankInfo> commonApiService;


	/*
	 * 新增页
	 */
	@GetMapping("/toAdd")
	public String toAdd(Model model){
		try {
			TcwPartnerBankInfo entity = new TcwPartnerBankInfo();
			entity.setVid(commonApiService.getCommonNextUkey(MenuId.TCW_PartnerBankInfo, "Vid"))
				.setStatus(1);
			return commonApiService.toAdd(model, entity.setBeneficiaryType(0), MenuId.TCW_PartnerBankInfo, null, null);
		} catch (Exception e) {
			e.printStackTrace();
			return W.error(model, e.getMessage());
		}
	}

	/*
	 * 编辑页
	 */
	@GetMapping("/toEdit")
	public String toEdit(Model model, HttpServletRequest request, HttpServletResponse response, Long id){

		try {
			return commonApiService.toEdit(model, id, new TcwPartnerBankInfo(), MenuId.TCW_PartnerBankInfo, null, null);
		} catch (Exception e) {
			e.printStackTrace();
			return W.error(model, e.getMessage());
		}
	}
}
